package cn.net.xyan.yypt.utils

import cn.net.xyan.blossom.kotlin.StatusAndMessageError
import java.io.InputStream

class ResourceUtils {
    companion object {

        fun openResource(resource: String): InputStream? {
            var input = ResourceUtils::class.java.classLoader.getResourceAsStream(resource)

            return input
        }

        fun readResource(resource: String): String {
            var input = openResource(resource)

            input?.use {
                var text = input.readBytes().toString(Charsets.UTF_8)

                return text
            }?:throw StatusAndMessageError("read error!")


        }
    }
}

